<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<link href="/shopping-mall/resources/bootstrap/css/bootstrap.css"
	rel="stylesheet" type="text/css" media="all" />
<h3>
	SHOPPING CART [ <small>${fn:length(cart.items)} Item(s) </small>]<a
		href="home-shop.html" class="btn btn-large pull-right"><i
		class="icon-arrow-left"></i> Continue Shopping </a>
</h3>
<hr class="soft" />
<table class="table table-bordered">
	<thead>
		<tr>
			<th>Product</th>
			<th>Description</th>
			<th>Quantity</th>
			<th>Unit Price</th>
			<th>Note</th>
			<th>Total</th>
		</tr>
	</thead>
	<tbody>
		<c:if test="${!empty cart}">
			<c:forEach items="${cart.items}" var="item" varStatus="status">
				<tr>
					<td><img width="60" src="${item.picture}" alt="" /></td>
					<td><c:out value="${item.name}" /></td>
					<td><c:out value="${item.quantity}" /></td>
					<td><c:out value="${item.price}" /></td>
					<td><c:if test="${!item.available }">
							<div class="alert alert-info">Out of amount exists</div>
						</c:if></td>
					<td colspan="3"><c:out value="${item.total}" /></td>
				</tr>
			</c:forEach>
		</c:if>
		<tr>
			<td colspan="6" style="text-align: right"><strong>TOTAL(
					<c:out value="${detailPrice}" /> )=
			</strong></td>
			<td class="label label-important" style="display: block"><strong>
					<c:out value="${total}" />
			</strong></td>
		</tr>
	</tbody>
</table>
<!-- Not logged yet , show login form -->
<c:if test="${LOGIN_STATUS == NOT_LOGGED_IN}">
	<table class="table table-bordered">
		<tr>
			<th>I AM ALREADY REGISTERED</th>
		</tr>
		<tr>
			<td>
				<form class="form-horizontal" action="login.html" method="POST">
					<div class="control-group">
						<label class="control-label" for="inputUsername">Username</label>
						<div class="controls">
							<input type="text" id="username" name="username"
								placeholder="Username">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="inputPassword1">Password</label>
						<div class="controls">
							<input type="password" id="password" name="password"
								placeholder="Password">
						</div>
					</div>
					<div class="control-group">
						<div class="controls">
							<button type="submit" class="btn">Sign in</button>
							OR <a href="register.html" class="btn">Register Now!</a>
						</div>
					</div>
					<div class="control-group">
						<div class="controls">
							<a href="forgetpass.html" style="text-decoration: underline">Forgot
								password ?</a>
						</div>
					</div>
				</form>
			</td>
		</tr>
	</table>
</c:if>


<!-- logged yet , show order infomations form -->
<c:if test="${LOGIN_STATUS == LOGGED_IN}">
	<table class="table table-bordered">
		<tr>
			<th>Order Informations</th>
		</tr>
		<tr>
			<td><form:form class="form-horizontal" method="POST"
					commandName="orders" action="makeorder.html">
					<div class="control-group">
						<label class="control-label" for="fullname">Full Name </label>
						<div class="controls">
							<input type="text" id="fullname" name="fullname"
								placeholder="Full Name" class="input-xlarge">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="email">Email</label>
						<div class="controls">
							<input type="text" id="email" name="email" placeholder="Email"
								class="input-xlarge">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="address">Address </label>
						<div class="controls">
							<input type="text" id="address" name="address"
								placeholder="Address" class="input-xlarge">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="phone">Phone</label>
						<div class="controls">
							<input type="text" id="phone" name="phone" placeholder="Phone"
								class="input-xlarge">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="">Payment method</label>
						<div class="controls">
							<form:select path="paymentmethod" id="paymentmethod" name="paymentmethod" class="input-xlarge">
								<form:option value="0">Cash</form:option>
								<form:option value="1">Online Payment</form:option>
							</form:select>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="note">Note</label>
						<div class="controls">
							<textarea class="field span4" rows="5" id="note" name="note"
								placeholder="Note"></textarea>
						</div>
					</div>
					<div class="control-group">
						<div class="controls">
							<button type="submit" class="btn">Make Order</button>
						</div>
					</div>
				</form:form></td>
		</tr>
	</table>

</c:if>


